﻿<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>数据字典</title>
	<jsp:include page="/resources/inc/head.jsp" flush="true"/>
</head>
<body>
<div id="main">
	<%--<form  id="queryForm" method="post">--%>

		<%--<td align="right" class="label">字段名：</td>
		<td>
			<input class="input-text easyui-validatebox" style="width:149px;" id="fieldName" type="text" name="fieldName"  />
		</td>
		<td align="right" class="label">字段注释：</td>
		<td>
			<input class="input-text easyui-validatebox" style="width:149px;" id="fieldComment" type="text" name="fieldComment" />
			&lt;%&ndash;<select id="cardtype" name="cardtype" style="width:149px;" class="select2" ></select>&ndash;%&gt;

			&lt;%&ndash;<select id="sel_menu3">
				<option value="3620194" selected="selected">请选择</option>
			</select>&ndash;%&gt;


		</td>--%>


	<%--</form>--%>
	<%--<div id="toolbar">--%>
		<%--<shiro:hasPermission name="upms:dict:read"><a class="waves-effect waves-button" href="javascript:;" onclick="queryAction()"><i class="zmdi zmdi-search"></i> 查询</a></shiro:hasPermission>--%>

	<%--</div>--%>
	<table id="table"></table>
</div>
<jsp:include page="/resources/inc/footer.jsp" flush="true"/>

<script>
var $table = $('#table');
$(function() {
    var dict  = new Dict('ENABLE');

	// bootstrap table初始化
	$table.bootstrapTable({
		url: '${basePath}/manage/base/dict/list',
		height: getHeight(),
		striped: true,
		search: true,
        //searchText: '',
		showRefresh: true,
		showColumns: true,
		minimumCountColumns: 2,
		clickToSelect: true,
		detailView: true,
		detailFormatter: 'detailFormatter',
		pagination: true,
		paginationLoop: false,
		sidePagination: 'server',
		silentSort: false,
		smartDisplay: false,
        cache: false,
		escape: true,
		searchOnEnterKey: true,
		idField: 'fieldName',
		maintainSelected: true,
		toolbar: '#toolbar',
        queryParams : function (params) {
            //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            var temp = {
                limit: params.limit,                         //页面大小
                offset: params.offset,   //页码
                sort: params.sort,      //排序列名
                order: params.order, //排位命令（desc，asc）
                fieldName:$("#fieldName").val(),
                fieldComment:$("#fieldComment").val()
            };
            return temp;
        },
		columns: [
			{field: 'fieldName', title: '字段名'},
			{field: 'fieldComment', title: '字段注释'},
            {field: 'fieldValue', title: '字典值'},
			{field: 'valueComment', title: '值注释'},
			{field: 'appFieldName', title: '应用字段名'},
			{field: 'status', title: '状态',formatter: function(value,row,index){
			    return dict.dictFormat(value);
			}},
			{field: 'orders', title: '排序'}
		]
	});
})

function queryAction() {
    $("#table").bootstrapTable('refresh');
}
</script>
</body>
</html>